package fr.nantes.guidetouristique;

import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import fr.nantes.guidetouristique.adapters.ListeAdapter;
import fr.nantes.guidetouristique.models.bouchons.ListeCultureBouchon;

public class ListeCultureActivity extends Activity {

	private ListView listView;
	private Context context;
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		context = this;
		setContentView(R.layout.listeculture);
		listView = (ListView) findViewById(R.id.listeCulture);
		
		List<String> listeCulture = ListeCultureBouchon.getListeCulture();
		ListeAdapter listeAdapter = new ListeAdapter(listeCulture, this);
		listView.setAdapter(listeAdapter);
		
		listView.setOnItemClickListener(new OnItemClickListener(){

			@Override
			public void onItemClick(AdapterView<?> adapter, View view, int position,
					long id) {
				if(id!=0){
					Intent intent = new Intent();
					intent.setClass(context, CultureActivity.class);
					context.startActivity(intent);
				}
			}
			
		});
    }
	
}
